#!/user/bin/env python3
# -*- coding: utf-8 -*-
"""
--------------------------------------
    Author:     JiChao_Song
    Date  :     2021/11/20 下午10:58
    Desc  :
--------------------------------------
"""
import logging
import os

from unittest import TestCase
from mongoengine import connect

from django_http_log.models import Log


os.environ['DJANGO_SETTINGS_MODULE'] = 'django_http_log'


class LogTest(TestCase):

    def setUp(self) -> None:
        connect(db = 'test')


    def test_log_add(self):

        Log(path = '/test', method = 'GET', ip = '127.0.0.1').save()
        self.test_log_list()

    def test_log_list(self):

        for i in Log.objects:
            print(i.path)
            print(i.method)
            print(i.ip)
